#include<stdio.h>
#define N 100
void deToOc(int num)
{
	int arr[N] = {0}, i= 0;
	while(num != 0)
	{
		arr[i++] = num % 8;
		num /= 8;
	}
	int j = 0;
	for(j = i - 1;j >= 0; j--)
	{
		printf("%d",arr[j]);
	}
}

int main()
{
	int n;
	scanf("%d",&n);
	deToOc(n);	
	return 0;
}
